package sch.frog.behavioral.mediator;

public class ConcreteMediator implements Mediator{


    private Colleague colleague1;

    private Colleague colleague2;

    @Override
    public void doSomething(String arg, Colleague caller) {
        if(caller != colleague1){
            colleague1.run(arg);
        }else if(caller != colleague2){
            colleague2.run(arg);
        }
    }

    @Override
    public void setColleague1(Colleague c) {
        this.colleague1 = c;
        c.setMediator(this);
    }

    @Override
    public void setColleague2(Colleague c) {
        this.colleague2 = c;
        c.setMediator(this);
    }
}
